package com.taptech.doufu.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import android.view.View;
import android.widget.TextView;

import com.taptech.doufu.R;

/**
 * Created by Wyatt on 2017/9/18/018.
 */

public class DoubleBtnLongTextDialog extends Dialog{
    private TextView tvTitle,tvTip,tvBtnCancel,tvBtnSure;
    private String tip,title;
    private CallBack callBack;
    public DoubleBtnLongTextDialog(@NonNull Context context, int theme, String tip, String title, CallBack callBack) {
        super(context,theme);
        this.tip = tip;
        this.title = title;
        this.callBack = callBack;
    }

    public interface CallBack{
        void onBack();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_double_btn);
        tvTitle = (TextView) findViewById(R.id.tvTitle);
        tvTitle.setText(title);
        tvTip = (TextView) findViewById(R.id.tvTip);
        tvTip.setText(tip);
        tvBtnCancel = (TextView) findViewById(R.id.tvBtnCancel);
        tvBtnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        tvBtnSure = (TextView) findViewById(R.id.tvBtnSure);
        tvBtnSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                callBack.onBack();
            }
        });
    }
}
